package javaBase.nowcoder.HJ80_A_整型数组合并;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    static TreeSet<Integer> treeSet = new TreeSet<>();

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str1 = br.readLine();
        String str2[] = br.readLine().split(" ");
        String str3 = br.readLine();
        String str4[] = br.readLine().split(" ");

        Arrays.stream(str2).mapToInt(Integer::parseInt).forEach(x -> {
            treeSet.add(x);
        });
        Arrays.stream(str4).mapToInt(Integer::parseInt).forEach(x -> {
            treeSet.add(x);
        });
        treeSet.stream().forEach(x -> {
            System.out.print(x);
        });
    }
}
